****************************************************************************************************
* Comrades in Arms? Rebel Leadership Roles and Coups in Rebel Regimes
****************************************************************************************************

* Analysis run using Stata18

**************************************************
* Table 1: Main Results
**************************************************

* Bivariate
logit colpus_attempt frontline, robust cluster(cowcode)
est store m1

* Full Model
logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)
est store m2


esttab m1 m2 using "TableRep1.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table 1. Wartime Leadership Role and Coups in Rebel Regimes") addnotes("Robust standard errors account for country clustering.") page(fullpage)


***************************************************************
* Figure 1: Marginal Effect of Leadership Role on Coup attempts
***************************************************************

quietly logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)

margins, at (frontline=(0,1))
marginsplot, recast(scatter) title ("") ytitle("Probability of Coup") xtitle("Leadership Role") xlabel (0 "Remote Leadership" 1 "Frontline Leadership", labsize(small)) graphregion(margin(l+10 r+10)) graphregion(fcolor(white))



* APPENDIX

**************************************************
* Table A2: Summary Statistics
**************************************************

sum colpus_attempt colpus_success frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar colpus_attempt colpus_success resource milexpercap milpercap 


***************************************************************
* Table A3 Model 1: Controlling for Military Expenditure 
***************************************************************

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar milexpercap, robust cluster(cowcode)
est store m3

 
***************************************************************
* Table A3 Model 2: Controlling for Military Personnel per Capita 
***************************************************************

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar milpercap, robust cluster(cowcode)
est store m4


***************************************************************
* Table A3 Model 3: Controlling for Oil Wealth
*************************************************************** 

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar lnoil, robust cluster(cowcode)
est store m5

esttab m3 m4 m5 using "TableRep3.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A3") addnotes("Robust standard errors account for country clustering.") page(fullpage)


***************************************************************
* Table A4: Addressing electoral victors
***************************************************************

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar electoral, robust cluster(cowcode)
est store m6

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar if electoral == 0, robust cluster(cowcode)
est store m61

esttab m6 m61 using "TableRep4.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A4") addnotes("Robust standard errors account for country clustering.") page(fullpage)



***************************************************************
* Table A5: Controlling for Post-War Instability and Persistent Opposition
***************************************************************

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar war_ongoing, robust cluster(cowcode)
est store m7

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar orgidentity, robust cluster(cowcode)
est store m8


logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar war_ongoing orgidentity, robust cluster(cowcode)
est store m9


esttab m7 m8 m9 using "TableRep5.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A5") addnotes("Robust standard errors account for country clustering.") page(fullpage)


***************************************************************
* Table A6: Year Fixed-Effects
***************************************************************

logit colpus_attempt frontline i.year, robust cluster(cowcode)
est store m10

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac i.year, robust cluster(cowcode)
est store m11

esttab m10 m11 using "TableRep6.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A6") addnotes("Robust standard errors account for country clustering." "Year Fixed Effects included but not reported") page(fullpage)


***************************************************************
* Table A7: Successful Coups 0nly
***************************************************************

logit colpus_success frontline, robust cluster(cowcode)
est store m12


logit colpus_success frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)
est store m13

esttab m12 m13 using "TableRep7.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A7") addnotes("Robust standard errors account for country clustering.") page(fullpage)


***************************************************************
* Table A8: Evaluating Mechanism Over Time 
***************************************************************


* Controlling for Regime Duration
logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar reg_duration, robust cluster(cowcode)
est store m14


* Ten-Year Model
logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar if tenyear == 1, robust cluster(cowcode)
est store m15

*Founding Leaders Only

logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar if firstleader == 1, robust cluster(cowcode)
est store m16

*Successors Only
logit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar if firstleader == 0, robust cluster(cowcode)
est store m17


esttab m14 m15 m16 m17 using "TableRep8.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A8") addnotes("Robust standard errors account for country clustering.") page(fullpage)

***************************************************************
* Table A9: Alternative Operationalization of Independent Variable
***************************************************************


*Incumbent Wartime Role
logit colpus_attempt incumbent_front high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)
est store m18


esttab m18 using "TableRep9.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A9") addnotes("Robust standard errors account for country clustering.") page(fullpage)

***************************************************************
* Table A10: Substituting Marxist-Leninist for Social Revolutionary Ideology
***************************************************************


* Full Model
logit colpus_attempt frontline high_intensity independence marxist lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)
est store m19

esttab m19 using "TableRep10.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A10") addnotes("Robust standard errors account for country clustering.") page(fullpage)


***************************************************************
* Table A11: Rare Events Logistic Regression
***************************************************************

relogit colpus_attempt frontline, cluster(cowcode)
est store m20

relogit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, cluster(cowcode)
est store m21

esttab m20 m21 using "TableRep11.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A11") addnotes("Robust standard errors account for country clustering.") page(fullpage)



***************************************************************
* Table A12: Multilevel Modeling
***************************************************************

melogit colpus_attempt frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar || rebcode:
est store m22

esttab m22 using "TableRep12.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A12") addnotes("Robust standard errors account for country clustering.") page(fullpage)



***************************************************************
* Table A13: Exploring the Mechanism
***************************************************************

reg milexpercap frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)
est store m23

logit purge frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)
est store m24

logit commissar frontline high_intensity independence socialrev lnrgdp lnpop ethfrac coldwar, robust cluster(cowcode)
est store m25

esttab m23 m24 m25 using "TableRep13.rtf", replace b(3) se(3) star(* 0.1 ** 0.05 *** 0.01) l ti("Table A12") addnotes("Robust standard errors account for country clustering.") page(fullpage)

